setClass("UnifNoiseRowBootstrapedSet",contains="vRowBootstrapedSet",
		representation(
				.percentOfNoisePoints="numeric"
		),
		prototype=prototype(
				
				.percentOfNoisePoints=0.05,
				.description="Uniform Noise Row bootstrap Class "
		),
		validity=function(.Object){
			if( (.Object@.percentOfNoisePoints <=0 )| (.Object@.percentOfNoisePoints >1) ){
				stop(".percentOfNoisePoints must be in (0;1]")
			}
			if( .Object@.percentOfNoisePoints >=0.20){
				warning("percent of noise points is high")
				
			}
		}

) 

##methods


setMethod("initialize",
		signature="UnifNoiseRowBootstrapedSet",
		function(.Object,inputSet,bSamplesNumber,percentOfNoisePoints=0.05,...){
			.Object <-callNextMethod(.Object,inputSet,bSamplesNumber,...);
			.Object@.percentOfNoisePoints <-  percentOfNoisePoints
			
			
			validObject(.Object)			
			return(.Object)
		})

setMethod("changeSet",
		signature="UnifNoiseRowBootstrapedSet",
		definition=function(.Object,inputSet,...){
			.Object<-initialize(.Object,inputSet=inputSet,bSamplesNumber=.Object@.bSamplesNumber,percentOfNoisePoints=.Object@.percentOfNoisePoints,...)
			
			
			return(.Object)
		})


setMethod("getAt",
		signature="UnifNoiseRowBootstrapedSet",
		definition=function(.Object,position,...){
			.Object@.currentSet <-callNextMethod(.Object,position,...);
			
			setDims <- dim(.Object@.originalSet$X)
			
			addedRowsNumber <- max( round( setDims[1] * .Object@.percentOfNoisePoints), 1 )
			
			
			#find minmum and maximum value of atributtes 
			colsMinVec <- unlist(lapply(1:setDims[2], FUN=function(n,dat){
								min(dat[,n])
							},  .Object@.originalSet$X
							))

			colsMaxVec <- unlist(lapply(1:setDims[2], FUN=function(n,dat){
								max(dat[,n])
							},  .Object@.originalSet$X
							))
					
			#generate noise points
			
			
			noisePoints <- matrix(runif(addedRowsNumber*setDims[2], min=colsMinVec, max=colsMaxVec ),ncol=setDims[2],byrow=TRUE )
			
			.Object@.currentSet$X <- rbind(.Object@.currentSet$X,noisePoints)
			#if Y element of set exists add new class for noise points
			
			if(.Object@.areClassesPresent){
				newClassNum <- max(.Object@.originalSet$Y) +1
				noiseClassVec <- rep(newClassNum,addedRowsNumber)
				.Object@.currentSet$Y <- c(.Object@.originalSet$Y,noiseClassVec)
				
			}
			print("ret")
			
			return(.Object@.currentSet)
			
		})

